<template>
	<view class="my-search-container" :style="{'background-color':bgcolor}" @click="searchBoxHandler">
		<!-- 使用 view 组件模拟 input 输入框的样式 -->
		<view class="my-search-box" :style="{'border-radius':radius+'px'}">
			<uni-icons type="search" size="17" color="#c4c2ff"></uni-icons>
			<text class="placeholder">搜索</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "my-search",
		data() {
			return {

			};
		},
		props: {
			//背景颜色
			bgcolor: {
				type: String,
				default: '#adb0ff'
			},
			// 圆角尺寸
			radius: {
				type: Number,
				default: 18
			}
		},
		methods: {
			searchBoxHandler() {
				// 类似自定义组件的事件绑定
				this.$emit('click')
			}
		}
	}
</script>

<style lang="scss">
	.my-search-container {
		height: 100rpx;
		// background-color: #adb0ff;
		display: flex;
		align-items: center;
		padding: 0 20rpx;
		text-align: center;

		.my-search-box {
			width: 100%;
			height: 72rpx;
			background-color: #FFFFFF;
			// border-radius: 36rpx;

			.placeholder {
				line-height: 72rpx;
				font-size: 30rpx;
				font-weight: 700;
				color: #c4c2ff;
				margin-left: 10rpx;
			}
		}
	}
</style>
